//校验外出流程是否在同一个月
jQuery(document).ready(function() {

    checkCustomize = function() {

        //获取明细表的所有标识
        var ideIndex = WfForm.getDetailAllRowIndexStr("detail_1");


        //开始日期id
        var detail_fromDateField = WfForm.convertFieldNameToId("detail_fromDate", "detail_1");
        //结束日期id
        var detail_toDateField = WfForm.convertFieldNameToId("detail_toDate", "detail_1");
       // 获取到第一行的开始日期的月份
        var firstDate = WfForm.getFieldValue(detail_fromDateField + "_0");
        var firstMonth;
        if (firstDate != "") {
            firstMonth = firstDate.split("-")[1];
        }


        //循环所有的开始日期的月份是否跟第一行的月份相等
        if (ideIndex != "") {
            var subArr = ideIndex.split(",");
            for (var i = 0; i < subArr.length; i++) {
                var formDate = WfForm.getFieldValue(detail_fromDateField + "_" + subArr[i]);
                var toDate = WfForm.getFieldValue(detail_toDateField + "_" + subArr[i]);
                if (formDate != "") {
                    var fromMotn = formDate.split("-")[1];

                    if (fromMotn != firstMonth) {
                        alert("因报表统计，故所填写外出日期必须在同一月内。");
                        return false;

                    }

                }


                if (toDate != "") {
                    var toMonth = toDate.split("-")[1];

                    if (toMonth != firstMonth) {
                        alert("因报表统计，故所填写外出日期必须在同一月内。");
                        return false;

                    }

                }

            }

        }

        return true;


    }



})